"""
图像缩放
"""
import cv2

img = cv2.imread('../data/Linus.png')
cv2.imshow('img',img)

h,w = img.shape[:2]
# 缩小
dst_size = (int(w/2),int(h/2))
res = cv2.resize(img,dst_size)
cv2.imshow('reduce',res)

# 放大
dst_size1 = (200,300)
res1 = cv2.resize(img,dst_size1,interpolation=cv2.INTER_NEAREST)
cv2.imshow('zoom_near',res1)
dst_size1 = (200,300)
res1 = cv2.resize(img,dst_size1,interpolation=cv2.INTER_LINEAR)
cv2.imshow('zoom_linear',res1)

cv2.waitKey()
cv2.destroyAllWindows()